#!/usr/bin/env python
#coding=utf-8

import os,time

def my_fork():

	for i in range(32):
		pid = os.fork()
		if pid == 0:
			print os.getpid()
			# time.sleep(5)
			break
		else:
			# print 'parent process', os.getpid(), pid
			# time.sleep(5)
			pass

def fookkk():
	a = 'abc'
	res = os.fork()
	if res == 0:
		print 'child process', os.getpid(), res
		print 'a', a
		time.sleep(5)
		a = 'cde'
		print 'a', a, os.getpid()
	else:
		print "parent process", os.getpid(), res
		print 'a', a
		time.sleep(5)
		a = 'def'
		print 'a', a, os.getpid()

if __name__ == '__main__':
	# my_fork()
	fookkk()